package code07_面向对象.封装;

/**
 * @author 黄衡熙
 * @version 1.0
 * @date 2025年07月21日19:00
 */
public class Emp {
    private String name;
    private double salary;
    private String gender;
    private int age;

    public Emp() {
    }

    public Emp(String gender) {
        this.gender = gender;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public String getGender() {
        return gender;
    }

    public int getAge() {
        if (age < 18) {
            return 18;
        }
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void show() {
        System.out.println("姓名:" + getName() + ",工资:" + getSalary() + ",性别:" + getGender() + ",年龄:" + getAge());
    }

    public void work() {
        System.out.println(name + "正在不停的996,就为了赚取" + salary + "的工资");
    }
}
